import time


def execute_time(code, *args, **kwargs):
    """代码执行时间计算"""
    s = time.perf_counter()
    ret = code(*args, **kwargs)
    e = time.perf_counter()
    speed = round((e - s) * 1000, 2)
    if ret is not None:
        return speed, ret
    else:
        return speed


if __name__ == '__main__':
    def utils_import():
        import utils


    print('utils_import', execute_time(utils_import))
